<?php
/**
 * Created by PhpStorm.
 * User: Colin
 * Date: 2018/6/28
 * Time: 11:53
 */

namespace app\library;


class File
{
    //保存文件
    public static function saveFile($fileName, $text) {
        if (!$fileName || !$text)
            return false;
        if (makeDir(dirname($fileName))) {
            if ($fp = fopen($fileName, "w")) {
                if (@fwrite($fp, $text)) {
                    fclose($fp);
                    return true;
                } else {
                    fclose($fp);
                    return false;
                }
            }
        }
        return false;
    }
}